import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.ListIterator;

/**
 * @program:
 * @description: TODO
 * @author: dingwen
 * @create: 2020/12/18 16:20
 **/
public class Hello {
    public static void main(String[] args) {

        // 1.自动导包，自动删包
        List<Integer> numberList = new ArrayList<>();

        // 2. if else
        String hello = "hello";
        if ("hello".equals(hello)) {

        }
        if (!"world".contains(hello)) {

        }

        if (hello != null) {

        }

        if (hello != null) {

        }
        if (hello == null) {

        }


        //3. for while

        for (int i = 0; i < 10; i++) {

        }

        for (int i = 10; i > 0; i--) {

        }

        while (hello.equals("test")) {

        }

        // 4. try
        try {
            int sum = 1 + 2;
        } catch (Exception e) {
            e.printStackTrace();
        }

        // 5.val
        Object object = new Object();


        // 7.sout  soutv
        System.out.println("hello = " + hello);


        // 8.集合
        List<Integer> integerList = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9);
        for (Integer integer : integerList) {

        }

        for (int i = 0; i < integerList.size(); i++) {
            System.out.println("integerList.get(i) = " + integerList.get(i));
        }

        for (int i = integerList.size() - 1; i >= 0; i--) {
            System.out.println("integerList.get(1) = " + integerList.get(1));
        }
        ListIterator<Integer> integerListIterator = integerList.listIterator();
        while (integerListIterator.hasNext()) {
            System.out.println("integerListIterator.next() = " + integerListIterator.next());
        }
    }

    public int add (int a,int b){
        // 6.return
        return a + b;
    }
}
